package com.rsstuan.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.rsstuan.utils.CityUtils;

public class StaticPageController extends SpringController{

	 
	 private String template;
	 
	 public ModelAndView handleRequestInternal(HttpServletRequest request,
	            HttpServletResponse response) {
		 
		 Map<String, Object> model = new HashMap<String,Object>();
		
		 String city = null;
			int cityid = 1;
			if (request.getParameter("cityid") != null) {
				try {
					cityid = Integer.parseInt(request.getParameter("cityid"));
					city = CityUtils.getCity(cityid);
				} catch (Exception e) {
				}
			}
			if (city == null)
				city = CityUtils.DEFAULT_CITY;
			model.put("city", city);
			model.put("cityid", cityid);
		 return createModelAndView(request, response, template, model);
	 }

	/**
	 * @param template the template to set
	 */
	public void setTemplate(String template) {
		this.template = template;
	}
	        

	 

}


